"""
========
m.config
========

A few configuration variables defining the syntax of the templates.

"""

import re

operators = {'==': lambda left, right: left == right, '!=': lambda left, right: left != right, '<': lambda left, right: left < right, '>': lambda left, right: left > right, '<=': lambda left, right: left <= right, '>=': lambda left, right: left >= right, 'in': lambda left, right: left in right}

TAG_START = '{%'
TAG_END = '%}'
VARIABLE_START = '{{'
VARIABLE_END = '}}'

TEXT_ID = 0
VARIABLE_ID = 1
TAG_ID = 2

token_regexp = re.compile('(%s.*?%s|%s.*?%s)' % (re.escape(TAG_START), re.escape(TAG_END), re.escape(VARIABLE_START), re.escape(VARIABLE_END)))
